// type Params = {
//   id: string
// }

interface Params {
  id: string;
}

let p: Params = { id: "1" };
type A = typeof p;

// interface Params {
//   name:string
// }

// type MyRecord = {
//   [key: string]: string;
//   // age:number // error
// }

// const record: MyRecord = {
//   name: "jack",
//   type: "admin",
//   sex: "男",
//   age: 20
// }

interface MyInterface {
  name: string;
}

type MyType = {
  name: string;
};

interface MyRecord {
  [key: string]: string;
}

const example1: MyInterface = { name: "example1" };
const example2: MyType = { name: "example2" };

let record: MyRecord = {};
record = example2;
// record = example1; //error

// 模拟的react-router中的useParams函数
function useParams<
  ParamsOrKey extends string | Record<string, string | undefined>
>() {}

useParams<MyType>();

// useParams<MyInterface>(); //error
